/**
 * 
 */
package captor.crosscuttingdomainsystem;

import java.util.List;

import captor.crosscuttingdomainsystem.crosscuttinginfo.DomainInfo;
import captor.crosscuttingdomainsystem.crosscuttinginfo.DomainInfoType.CompatibleDomainsType.DomainType.PreDefinedPointcutsType.AbstractPointcutType;
import captor.domainsystem.DomainException;
import captor.domainsystem.Forms;
import captor.lib.intl.MyIntl;
import captor.modelsystem.CaptorDomain;
import captor.modelsystem.Model;

/**
 * @author Carlos
 *
 */
public class CrosscuttingDomain extends CaptorDomain {
	
	private Forms forms;
	private List<AbstractPointcutType> preDefinedPointcuts;

	public CrosscuttingDomain(){
		super();
	}
	
	public CrosscuttingDomain(Model model, String nameDomain){
		super(model, nameDomain);
	}
	
	public CrosscuttingDomain(Model model, String nameDomain, DomainInfo crosscuttingDomainInfo){
		super(model, nameDomain, crosscuttingDomainInfo);
	}
	
	public void validateDomain() throws DomainException, CrosscuttingDomainException{
		
		super.validateDomain();
		if (!crosscuttingDomainInfo.isCrosscuttingDomain()){
			throw new CrosscuttingDomainException(MyIntl.MSG126);
		}
	}
	
	@Override
	public boolean isCrosscuttingDomain(){
		return true;
	}
	
	/**
	 * @return the forms
	 */
	public Forms getForms() {
		return forms;
	}

	/**
	 * @param forms the forms to set
	 */
	public void setForms(Forms forms) {
		this.forms = forms;
	}

	@Override
	public String getDomainDescription() {		
		return MyIntl.MSG125;
	}
	
	public class CrosscuttingDomainException extends DomainException{
		
		/**
		 * 
		 */
		private static final long serialVersionUID = 1863412242533567771L;

		public CrosscuttingDomainException(){};
		
		public CrosscuttingDomainException(String msgException){
			super(msgException);
		}
		
		public String toString() {
			return MyIntl.MSG122;
			}
	}

	/**
	 * @return the preDefinedPointcuts
	 */
	public List<AbstractPointcutType> getPreDefinedPointcuts() {
		return preDefinedPointcuts;
	}

	/**
	 * @param preDefinedPointcuts the preDefinedPointcuts to set
	 */
	public void setPreDefinedPointcuts(
			List<AbstractPointcutType> preDefinedPointcuts) {
		this.preDefinedPointcuts = preDefinedPointcuts;
	}
	
}
